package com.hz.score.lab.controller;

import com.hz.score.common.dto.PageDto;
import com.hz.score.lab.dto.LabInfoDto;
import com.hz.score.lab.service.LabService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "企业标签编辑类", description = "编辑企业标签数据")
@Controller
@RequestMapping("/lab")
public class LabController {

    @Resource
    LabService labService;

    @ApiOperation("分页查询企业标签数据")
    @PostMapping("/page")
    @ResponseBody
    private PageDto<LabInfoDto> pageBaseEnt(@RequestBody LabInfoDto labInfoDto,
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        return labService.pageLabEnt(labInfoDto, pageSize, pageNum);
    }

    @ApiOperation("新增企业标签数据")
    @PostMapping("/new")
    @ResponseBody
    private void newBaseEnt(@RequestBody LabInfoDto labInfoDto) {
        labService.newLabEnt(labInfoDto);
    }

    @ApiOperation("修改企业标签数据")
    @PostMapping("/update")
    @ResponseBody
    private void updateBaseEnt(@RequestBody LabInfoDto labInfoDto) {
        labService.updateLabEnt(labInfoDto);
    }

    @ApiOperation("删除企业标签数据")
    @PostMapping("/delete")
    @ResponseBody
    private void delBaseEnt(@RequestBody LabInfoDto labInfoDto) {
        labService.delLabEnt(labInfoDto);
    }

    @ApiOperation("获取企业标签数据")
    @PostMapping("/get")
    @ResponseBody
    private LabInfoDto getBaseEnt(@RequestParam(value = "id") Long id) {
        return labService.getLabEnt(id);
    }
}
